package com.junson.utils;

public class HexUtils {

	public static String bytesToHexStr(byte[] src) {
		
		if (src == null || src.length <= 0) {
			return null;
		}
		StringBuilder stringBuilder = new StringBuilder("\n[");
		for (int i = 0; i < src.length; i++) {
			
			int v = src[i] & 0xFF;
			String hv = Integer.toHexString(v);
			if (hv.length() < 2) {
				stringBuilder.append("0");
			}
			stringBuilder.append(hv.toUpperCase());
			stringBuilder.append(" ");
		}
		stringBuilder.append("]");
		return stringBuilder.toString();
	}
}
